#!/usr/bin/perl

require "./mailadmin-lib.pl";
&ReadParse();

my ($vols, $err_msg, $dirpath, $mntroot, %isvol, $k);

$mntroot = &get_mnt_root();
@v = &get_volumes();

foreach $k (@v)
{
    $isvol{$k} = "yes";
}

$vols = $in{'selvol'};

unless ($vols)
{
    $err_msg = $text{'msg_err_vols_empty'};
    goto ERROR_OUT;
}

if ($isvol{$vols} ne "yes")
{
    $err_msg = $text{'msg_err_select_vols_not_exist'};
    goto ERROR_OUT;
}

$err_msg = &mail_conf_chgdir($vols);

&redirect("maildir_edit.cgi");


exit(0);

ERROR_OUT:;
my (@headp, @footp);
@headp = ($text{'error'}, "");
@footp = ("maildir_edit.cgi", $text{'back_maildir'});
&mail_error(\@headp, \@footp, $text{'err_title_load_maildir_conf'}, $err_msg);
